﻿@model IEnumerable<MvcShopping.Models.Product>
@{Layout = null;}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thirteen Shop</title>
<meta name="keywords" content="" />
    <meta name="description" content=""/>

    <link rel="stylesheet" href="~/tpl/static/css/bootstrap.min.css" type="text/css" media= "all"/>
    <link rel="stylesheet" href="~/tpl/static/css/jquery-ui.min.css" type="text/css" media= "all"/>
    <link rel="stylesheet" href="~/tpl/Admin/common/css/admin.css" type="text/css"/>
    <link href="~/Content/alert.css" rel= "stylesheet"/>


    <style >
   #Url{
            display: none;
        }

        .black{
            color: black;
        }
    </style>
<script type="text/javascript" src="~/tpl/static/js/jquery-1.9.1.min.js"></script>
<script src="~/Scripts/alert.js"></script >
<script type="text/javascript" src="~/tpl/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="~/tpl/static/js/jquery.artDialog.js?skin=aero"></script>
<script type="text/javascript" src="~/tpl/static/js/iframeTools.js"></script>
<script type="text/javascript" src="~/tpl/static/js/jquery.form.min.js"></script>
<script type="text/javascript" src="~/tpl/static/js/jquery.validate.min.js"></script>
<script language="javascript" src="~/tpl/static/js/jquery.imagePreview.js"></script>
<script type="text/javascript" src="~/tpl/static/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="~/tpl/static/js/datepicker.js"></script>
<script type="text/javascript" src="~/tpl/Admin/common/js/common.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.js">
</script >

</head>

        <body>
           
    <nav class="navbar navbar-inverse">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <a class="navbar-brand" href="~/Home/index">Thirteen Shop后台管理</a>
                    </div>

                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav navbar-right">
                            <li>
                                <a href="~/Home/index" target="_blank"><i class="glyphicon glyphicon-home"></i> 网站首页</a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="glyphicon glyphicon-user"></i> 超级管理员【admin】 <span class="caret"></span></a>
                                <ul class="dropdown-menu" role="menu">
                                   
                                    <li >
                                        <a href="~/Home/index">退出</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                    <!-- /.navbar-collapse -->
           </div>
                <!-- /.container-fluid -->
    </nav>
            <!--顶部结束-->
    <div class="container-fluid">
                <div class="row">
                    <div class="col-md-2">
                        <div id="nav" >
                            <p id="p_home"><i class="glyphicon glyphicon-home"></i> 首页</p>
                            <p id="p_article" ><i class="glyphicon glyphicon-list-alt"></i> 商品管理</p>
                            <div class="menu_body" id="b_article">
                                <li>
                                    <a href="~/Admin/Add" ><i class="glyphicon glyphicon-menu-right"></i> 添加商品</a>
                                </li>
                                <li>
                                    <a href="~/Admin/index" ><i class="glyphicon glyphicon-menu-right"></i> 商品列表</a>
                                </li>
                            </div>

                            <p id="p_user" ><i class="glyphicon glyphicon-user"></i> 用户管理</p>
                            <div class="menu_body" id="b_user">
                                <li>
                                    <a href="~/AdminMember/Add" ><i class="glyphicon glyphicon-menu-right"></i> 添加用户</a>
                                </li>
                                <li>
                                    <a href="~/AdminMember/index" ><i class="glyphicon glyphicon-menu-right"></i> 用户列表</a>
                                </li>
                                <li>
                                    <a href="~/AdminRegister/addMember" ><i class="glyphicon glyphicon-menu-right"></i> 新增管理员</a>
                                </li>
                            </div>
                            <p id="p_sys" ><i class="glyphicon glyphicon-cog"></i> 订单管理</p>
                            <div class="menu_body" id="b_sys">
                                <li>
                                    <a href="~/Admin/AdminOrder" > 查看订单 </a >
                                </li >

                            </div >
                            <p id="p_sys"><i class="glyphicon glyphicon-adjust"></i> 类别管理</p>
                            <div class="menu_body" id="b_sys">
                                <li>

                                    <a href="~/ProductCategories/Create" > 查看与添加 </a >
                                </li >

                            </div >

                            <p id="p_sys"><i class="glyphicon glyphicon-cog"></i> 日志管理</p>
                            <div class="menu_body" id="b_sys">
                                <li>
                                    <a href="~/Logs/Index" > 查看日志 </a >
                                </li >

                            </div >
                        </div >
                    </div >

                    <div class="col-md-10">

                        



<ol class="breadcrumb">
    <li>
        <a href="javascript:;">
            商品管理 </a ></li >
            <li class="active">商品列表</li>
</ol>


   <table class="table table-hover">
      <tr>
        <th>

            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Color)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Price)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PublishOn)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr class="tra">
        <td>
            @*<a href = "~/Home/ProductDetail.cshtml" style="color:black">
                    @Html.DisplayFor(modelItem => item.Name)
                </a>*@
            @Html.ActionLink(item.Name, "ProductDetail", "Home", new { id = item.Id }, new { color = "black", @class = "black" })
        </td>
        <td class="testTd1">
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td class="testTd2">
            @Html.DisplayFor(modelItem => item.Color)
        </td>
        <td class="testTd3">
            @Html.DisplayFor(modelItem => item.Price)元
        </td>
        <td class="testTd4">
            @Html.DisplayFor(modelItem => item.PublishOn)
        </td>
        <td>
            @Html.ActionLink("修改", "Edit", new { id = item.Id }) |
            <a href="javascript:;" class="deleteGood" data-id="@item.Id">删除</a>
            @* @Html.ActionLink("删除", "Delete", new { id = item.Id })*@
        </td>
        </tr>
    }

     </table>

          <script type="text/javascript">
                                $("#path").val("");
                        </script>


            </div>
        </div>

    </div>

<script type="text/javascript">
                                var M = {

                         }


    $(".deleteGood").each(function (index, value) {
        $(this).click(function () {

            var getid = parseInt($(this).attr('data-id'));
            var content = "<div><p>商品“" + $(".black")[index].innerText
                + "”信息</p><p>商品名称：" + $('.black')[index].innerText
                + "</p><p>商品简介:"
                + $('.testTd1')[index].innerText + "</p><p>颜色：" +
                $('.testTd2')[index].innerText + "</p><p>价格："
                + $('.testTd3')[index].innerText + "</p><p>发行时间："
                + $('.testTd4')[index].innerText + "</p></div>";
            var a = index;

            M.dialog7 = jqueryAlert({

                'style': 'pc',
                'title': '确认删除吗？',
                'content': content,
                'modal': true,
                'contentTextAlign': 'left',
                'width': '500',
                'height': '400',
                'animateType': 'linear',
                'buttons': {
                    '确定': function () {

                        $.ajax({
                            url: 'ChangeToAsp',
                            data: { id: getid },
                            success: function () {
                                $(".trFather").eq(a).remove();
                                M.dialog7.close();
                                if (M.dialog51) {
                                    return M.dialog51.show();
                                }
                                M.dialog51 = jqueryAlert({
                                    'content': '删除成功'
                                })
                            },
                            error: function () {
                                alert("服务器连接异常");
                                M.dialog7.close();
                            }
                        });

                    },
                    '取消': function () {
                        M.dialog7.close();
                        if (M.dialog51) {
                            return M.dialog51.show();
                        }
                        M.dialog51 = jqueryAlert({
                            'content': '删除失败'
                        })
                    }
                }
            });
            //$.ajax({
            //    url: "changeToAsp",
            //    data: { Content: getid},
            //    cache: false,
            //    type: 'post',
            //    datatype;"json",
            //    success: function (data) {
            //       // alert(data);

            //    },
            //    error: function (data) {
            //        alert("服务器连接异常");
            //    }
            //});
        });
    });
              $(document).ready(function () {


    //幻灯片元素与类“menu_body”段与类“menu_head”时点击
    var menu_action = $("#menu_action").val();
                $("#p_" + menu_action).addClass("select");
                $("#b_" + menu_action).show().addClass("local");

                $("#nav p").click(function() {
        $(this).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
    $("#nav p").removeClass("select");
                    $(this).addClass("select");
                    $(this).next("div.menu_body").addClass("local");
    });

                $("#picname_src").click(function() {
        $("#picname").click();
                    $("#Url").val($("#picname").val());
    })
            });
</script>

</body>

</html>
@section Scripts
{
    @Scripts.Render("~/bundles/jqueryval")
}